package edu.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import edu.core.PaginationSortOrderData;
import edu.dao.BaseDao;

@Service("baseService")
public class BaseService {
	@Autowired
	private BaseDao baseDao;
	
    public int deletePojoByHql(String hql) throws Exception {
    	return this.baseDao.batchDeleteByHql(hql);
    }
	
	public void insert(Object obj) throws Exception {
		baseDao.insert(obj);
	}

	public void update(Object obj) throws Exception {
		baseDao.update(obj);
	}
	
	public void delete(Object obj) throws Exception {
		baseDao.delete(obj);
	}
	
	public List selectAllByEntityClassName(Class entityClass) throws Exception {
		return this.baseDao.selectAllByEntityClassName(entityClass);
	}
	
	public PaginationSortOrderData selectPojoByPage(Class clazz,PaginationSortOrderData frontPage, List<String> sqlConditionList,String  orderBySql) throws Exception{
		return baseDao.selectPojoByPage(clazz, frontPage, sqlConditionList, orderBySql);
	}

	public List selectPojoByHql(String hql) throws Exception{
		return baseDao.selectPojoByHql(hql);
	}

	public Object selectObjById(Class clazz, String id) throws Exception{
		return baseDao.selectObjById(clazz, id);
	}
}
